/**
 *  Copyright (c) 2010 Alethia Inc,
 *  http://www.alethia-inc.com
 *  Developed by Travis Tidwell | travist at alethia-inc.com 
 *
 *  License:  GPL version 3.
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *  
 *  The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.

 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *  THE SOFTWARE.
 */
(function(a){jQuery.media=jQuery.media?jQuery.media:{};jQuery.media.defaults=jQuery.extend(jQuery.media.defaults,{pageLink:false});jQuery.fn.mediateaser=function(d,b,e,c){if(this.length===0){return null;}return new (function(j,g,k,f,h){h=jQuery.media.utils.getSettings(h);var l=this;this.display=f;this.display.unbind("mouseenter").bind("mouseenter",function(m){if(h.template.onTeaserOver){h.template.onTeaserOver(l);}});this.display.unbind("mouseleave").bind("mouseleave",function(m){if(h.template.onTeaserOut){h.template.onTeaserOut(l);}});this.index=k;this.node=this.display.medianode(j,h);if(this.node){this.node.loadNode(g);}if(this.node&&h.pageLink){var i=h.baseURL;i+=g.path?g.path:("node/"+g.nid);this.node.display.wrap('<a href="'+i+'"></a>');}this.reset=function(){if(this.node){this.node.display.unbind();}};this.setActive=function(m){if(h.template.onTeaserActivate){h.template.onTeaserActivate(this,m);}};this.setSelected=function(m){if(h.template.onTeaserSelect){h.template.onTeaserSelect(this,m);}};if(h.template.onTeaserLoad){h.template.onTeaserLoad(this);}})(d,b,e,this,c);};})(jQuery);